package xyz.jangle.design.chain;
/**
 * 具体处理者2
 * @author Administrator
 *
 */
public class ConcreteHandler2 implements Handler {
	
	private Handler handler;

	@Override
	public void handleRequst() {
		if((Math.random()*10) > 5) {	//模拟规则
			System.out.println("Handler2 处理了消息");
		}else {
			if(handler != null)
			handler.handleRequst();	//委托下一个节点处理
		}
	}

	@Override
	public void setNextHandler(Handler handler) {
		this.handler = handler;
	}

}
